﻿using CommonNet48.ObjMapper;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Mask;
using DevExpress.XtraEditors.Repository;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DevUIUtils
{
    public partial class MyDateRange : DevExpress.XtraEditors.XtraUserControl
    {
        [Category("MyCustom")]
        [Browsable(true)]
        [Description("标题")]
        public string LabelTitle
        {
            get => this.lblTitle.Text;
            set => this.lblTitle.Text = value;
        }

        private string _DataFormat = string.Empty;
        [Category("MyCustom")]
        [Browsable(true)]
        [Description("日期格式")]
        public string DateFormat
        {
            get { return _DataFormat; }
            set
            {
                this.dtBeg.Properties.EditMask = value;
                this.dtBeg.Properties.DisplayFormat.FormatString = value;
                this.dtEnd.Properties.EditMask = value;
                this.dtEnd.Properties.DisplayFormat.FormatString = value;
                _DataFormat = value;
            }
        }

        [Category("MyCustom")]
        [Browsable(true)]
        [Description("日期范围开始时间(包含)")]
        public DateTime BegingTime
        {
            get => this.dtBeg.DateTime;
            set => this.dtBeg.DateTime = value;
        }

        [Category("MyCustom")]
        [Browsable(true)]
        [Description("日期范围结束时间(包含)")]
        public DateTime EndTime
        {
            get => this.dtEnd.DateTime;
            set => this.dtEnd.DateTime = value;
        }


        //[NotifyParentProperty(true)]
        //[Browsable(true)]
        //public LabelControl TitleLabel
        //{
        //    get
        //    {
        //        return this.lblTitle;
        //    }
        //}
        //[Browsable(true)]
        //public DateEdit BeginDateEdit => this.dtBeg;
        //[Browsable(true)]
        //public DateEdit EndDateEdit => this.dtEnd;

        public MyDateRange()
        {
            InitializeComponent();
        }
    }
}
